home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
wlib11_4.zip
/
HEADERS.EXE
/
VIDSYS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-03-23
|
11KB
|
268 lines
/*** VIDSYS.H ***/
/* Written By P.A. McKenzie
* The C Window Library
* Copyright (C) 1990 All Rights Reserved
*/
/**********************************************
* Define video and other miscellaneous flags *
*********************************************/
#ifndef VSTRUCT_DEF
#include "proto.h"
#if defined (POWERC)
#define crt_status_port crtport
#define pagesize_ pagesiz_
#define caldelay_ caldely_
#endif
#ifndef offsetof
#define offsetof(type,memb) \
(unsigned)&((( type *)0x10)->memb)-(unsigned)(( type *)0x10)
#endif
/*************************
* Define Screen segments *
*************************/
#define MONO 0xB000
#define COLOR 0xB800
#define MAXBUFSIZE 1024
#define MAXSCROLLWIDTH 140
/********************************
* Define video block structure *
*******************************/
typedef struct
{
int upx; /* upper left column where
video block is defined */
int upy; /* upper row */
int lowx; /* lower right column */
int lowy; /* lower row */
int pagenum; /* page number where block
is opened */
char *scrnsave; /* pointer to video block
structure */
} *VBLOCKPTR, VBLOCK;
typedef struct
{
unsigned scrnwrt_flag:1; /* either BIOS or DMA */
unsigned cga_flag:1; /* cga flag */
unsigned mda_flag:1; /* mono adapter flag */
unsigned hgc_flag:1; /* Hercules flag */
unsigned vga_in_flag:1; /* vga installed flag */
unsigned vga_active_flag:1; /* vga is active flag */
unsigned vga_color_monitor:1; /* vga color monitor attached */
unsigned vga_color_flag:1; /* vga color mode on */
unsigned mcga_color_flag:1; /* MCGA color on */
unsigned mcga_in_flag:1; /* MCGA installed flag */
unsigned ega_in_flag:1; /* ega installed flag */
unsigned ega_active_flag:1; /* ega active flag */
unsigned ega_color_monitor:1; /* ega color monitor attached */
unsigned ega_color_flag:1; /* ega is in color mode flag */
} SYS_FLAGS;
typedef struct
{
unsigned int video_mode; /* current video mode */
unsigned int cursor_startline; /* starting scan line of the cursor */
unsigned int cursor_endline; /* ending scan line of the cursor */
unsigned int cursor_row; /* row of cursor */
unsigned int cursor_col; /* column of cursor */
unsigned int video_page; /* video page */
unsigned int video_pagesize; /* video page size in bytes */
unsigned int video_rows; /* number of displayable rows */
unsigned int video_cols; /* number of displayable columns */
unsigned int char_height; /* height of characters in scan lines */
unsigned int crt_port_address; /* address of crt status port */
unsigned int crt_mode_setting; /* mode setting of crt */
unsigned int crt_color_setting; /* color setting of crt */
} VIDEO_CONFIG;
#if defined (GLOBAL_DEF)
#define EXTERN
#else
#define EXTERN extern
#endif
EXTERN VIDEO_CONFIG initial_video_startup;
EXTERN int is_vga_color;
EXTERN int default_screen_attr; /* default screen attribute */
EXTERN int default_screen_tab_length;
EXTERN unsigned scrnseg_;
EXTERN unsigned char chksnow_;
EXTERN SYS_FLAGS video_system_flags;
EXTERN unsigned crt_status_port;
EXTERN int num_screen_rows; /* current # of rows displayed */
EXTERN int num_screen_cols; /* current # of columns displayed */
EXTERN int max_video_pages;
EXTERN int active_video_page; /* current active display page */
EXTERN int visible_video_page; /* current visible display page */
EXTERN unsigned int pagesize_; /* size of video page in bytes */
EXTERN int current_video_mode; /* current video mode */
EXTERN unsigned char window_char_buffer[MAXBUFSIZE]; /* global write buffer */
EXTERN unsigned char virtual_char_buffer[MAXBUFSIZE];
EXTERN unsigned char scroll_char_buffer[MAXSCROLLWIDTH];
EXTERN unsigned caldelay_;
/*******************
* Define box types *
********************/
#define DOUBLEBOX "╔═╗║║╚═╝"
#define SINGLEBOX "┌─┐││└─┘"
#define MIXEDBOX1 "╒═╕││╘═╛"
#define MIXEDBOX2 "╓─╖║║╙─╜"
#define HATCHBOX1 "░░░░░░░░"
#define HATCHBOX2 "▒▒▒▒▒▒▒▒"
#define HATCHBOX3 "▓▓▓▓▓▓▓▓"
#define SOLIDBOX1 "█▀████▄█"
#define SOLIDBOX2 "████████"
#define BLANKBOX " "
#define DOTTEDLINE "---||---"
#ifndef NUMBOXCHARS
#define NUMBOXCHARS 8
#endif
/* Macro Definitions */
#define SCREEN_WRITE_METHOD video_system_flags.scrnwrt_flag
#define CGA_ACTIVE video_system_flags.cga_flag
#define VGA_INSTALLED video_system_flags.vga_in_flag
#define VGA_ACTIVE video_system_flags.vga_active_flag
#define VGA_COLOR_ON video_system_flags.vga_color_flag
#define MCGA_COLOR_ON video_system_flags.mcga_color_flag
#define MCGA_INSTALLED video_system_flags.mcga_in_flag
#define EGA_INSTALLED video_system_flags.ega_in_flag
#define EGA_ACTIVE video_system_flags.ega_active_flag
#define EGA_COLOR_ON video_system_flags.ega_color_flag
#define VGA_MONO_ON (VGA_ACTIVE && !VGA_COLOR_ON)
#define EGA_MONO_ON (EGA_ACTIVE && !EGA_COLOR_ON)
#define HERCULES_ACTIVE video_system_flags.hgc_flag
#define MDA_ACTIVE video_system_flags.mda_flag
#define VGA_COLOR_ATTACHED video_system_flags.vga_color_monitor
#define EGA_COLOR_ATTACHED video_system_flags.ega_color_monitor
#define MONO_MODE_ON ((!EGA_COLOR_ON && !VGA_COLOR_ON && \
!MCGA_COLOR_ON && !CGA_ACTIVE) || \
(MDA_ACTIVE || HERCULES_ACTIVE))
#define COLOR_MODE_ON (!MONO_MODE_ON)
#define VGA_MODE_ON (VGA_ACTIVE)
#define EGA_MODE_ON (EGA_ACTIVE)
#define CGA_MODE_ON (CGA_ACTIVE)
#define MCGA_MONO_ON (MCGA_INSTALLED && VGA_ACTIVE && \
!MCGA_COLOR_ON)
#define MCGA_MODE_ON (MCGA_INSTALLED && VGA_ACTIVE)
#define VGA_MONO_ATTACHED (VGA_ACTIVE && !VGA_COLOR_ATTACHED)
#define CHECK_SNOW chksnow_
#define SCREEN_SEGMENT scrnseg_
#define VIDEO_PAGESIZE pagesize_
/* Video Macros */
#define LINEMODE43 (get_video_info(4) == 43)
#define LINEMODE50 (get_video_info(4) == 50)
#define LINEMODE25 (get_video_info(4) == 25)
#define CREATE_VIDEO_ATTRIBUTE(x,y) (((int)(x)<<4) + (y)) /* creates a video attribute */
#define GET_BGROUND_COLOR(c) ((int)(c)>>4)
#define GET_FGROUND_COLOR(c) ((int)(c) & 0x000F)
#define SCREEN_OFFSET(r,c,a) \
(((((r)-1)*num_screen_cols + (c)-1) + (a)*pagesize_)<<1)
#define GET_SEGMENT(x) \
((unsigned) ((long)(char far *)(x) >> 16))
#define GET_OFFSET(x) \
((unsigned) ((long)(char far *)(x) & 0x0000FFFF))
#define SCREEN_OFFSET_ATTR(r,c,a) (SCREEN_OFFSET((r),(c),(a))+1)
#define MAKE_FAR_POINTER(a,b) ((char far *)(((unsigned long)(a) << 16)+(b)))
#define GetVideoAttribute(row,col,page) get_chat((row),(col),(page),1)
#define GetVideoMode() get_video_info(1)
#define MoveCursor(row,col,page) goto_xy((row),(col),(page))
#define ReportCharacter(row,col,page) get_chat((row),(col),(page),0)
#if __cplusplus
extern "C" {
#endif
/* Fast Output/Non-window related Video Functions */
int CheckVideoPage P((int page));
void ClearRegion P((int urow, int ucol, int lrow, int lcol, int attr));
void ClearScreen P((int attr));
void GetCursorPosition P((unsigned *row, unsigned *col, int page));
void GetVideoBiosInfo P((VIDEO_CONFIG *video_struct));
void ScrollScreenUp P((int numlines, int urow, int ucol, int lrow,
int lcol, int attr));
void ScrollScreenDown P((int numlines, int urow, int ucol, int lrow,
int lcol, int attr));
int SetActiveVideoPage P((int page));
int SetVisibleVideoPage P((int page));
void SetVideoMode P((int modenum));
int SetVideoRows P((int numrows, int flag));
void VideoDrawBox P((int urow, int ucol, int lrow, int lcol, char *box));
void VideoDrawBoxAttr P((int urow, int ucol, int lrow, int lcol,
char *box, int attr));
void VideoFree P((VBLOCKPTR vid_block));
void VideoMove P((VBLOCKPTR vid_block, int row, int col));
void VideoPrintf P((char *format, ...));
void VideoPrintfAttr P((int attr, char *format, ...));
VBLOCKPTR VideoSave P((int urow, int ucol, int lrow, int lcol));
void VideoRestore P((VBLOCKPTR vid_block));
void VideoWriteString P((char *string, int row, int col));
void VideoWriteStringAttr P((char *string, int row, int col, int attr));
void VideoWriteAttributes P((char *string, int row, int col,
int length));
void VideoWriteCenterString P((char *string, int row));
void VideoWriteCenterStringAttr P((char *string, int row, int attr));
void VideoWriteCharAndAttr P((char *string, int row, int col,
int length));
void VideoWriteStringCC P((char *string, int row, int col));
void VideoWriteStringCCAttr P((char *string, int row, int col,
int attr));
void VideoWriteStringRJ P((char *string, int row, int col));
void VideoWriteStringRJAttr P((char *string, int row, int col,
int attr));
void VideoReadAttributes P((char *buffer, int row, int col,
int length));
void VideoReadCharacters P((char *buffer, int row, int col,
int length));
void VideoReadCharAndAttr P((char *buffer, int row, int col,
int length));
int InitializeScanLines(int,int);
int LoadCharacterSet(int,int);
void goto_xy P((int,int,int));
#if __cplusplus
}
#endif
#define VSTRUCT_DEF
#endif